﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediPlatform.Domain.Order
{
    /// <summary>
    /// 药品订单详情表
    /// </summary>
    public class MedicalOrderItem
    {
        /// <summary>
        /// 主键，自增
        /// </summary>
        [Key]
        public long? Id { get; set; }

        /// <summary>
        /// 外键，关联 MedicalOrder.Id
        /// </summary>
        public long? OrderId { get; set; }

        /// <summary>
        /// 药品ID，外键关联药品表
        /// </summary>
        public long? MedicineId { get; set; }

        /// <summary>
        /// 药品名称（下单时快照）
        /// </summary>
        [StringLength(100)]
        public string? MedicineName { get; set; }

        /// <summary>
        /// 规格（如：10mg*30片）
        /// </summary>
        [StringLength(50)]
        public string? Specification { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        [Range(0, double.MaxValue)]
        public decimal? UnitPrice { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        [Range(1, int.MaxValue)]
        public int? Quantity { get; set; }

        /// <summary>
        /// 小计金额
        /// </summary>
        [Range(0, double.MaxValue)]
        public decimal? Subtotal { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; } = DateTime.Now;
    }
}
